﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;

namespace DllCallAnalysis45
{
    public static class ExceptionHelper
    {
        public static string BuildExceptionMessage(Exception ex)
        {
            var sb = new StringBuilder();

            FullMessage(ex);

            return sb.ToString();

            void FullMessage(Exception current)
            {
                sb.AppendLine(current.ToString());

                if (current.InnerException != null) 
                {
                    sb.AppendLine("==============================");
                    FullMessage(current.InnerException);
                }
            }
        }
    }
}
